package com.rainsoft.center.isec.frame.factory.handler;

import com.rainsoft.center.isec.frame.handler.impl.SaveToHbaseHandler;
import com.rainsoft.center.isec.frame.handler.impl.SaveToUDBHandler;
import com.rainsoft.center.isec.stream.library.entity.hbase.BaseLibEntity;

/**
 * @Package com.rainsoft.center.isec.frame.factory
 * @Description:
 * @Author elwyn
 * @Date 2017/12/10 23:21
 * @Email elonyong@163.com
 */
public abstract class HandlerFactory {
    public static HandlerFactory getFactory(String handlerClass) {
        HandlerFactory handlerFactory = null;
        try {
            handlerFactory = (HandlerFactory) Class.forName(handlerClass).newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            System.out.println("没有找到" + handlerClass + "处理类");
        }
        return handlerFactory;
    }

    public abstract <T extends BaseLibEntity> SaveToHbaseHandler<T> getHbaseHandler(String tableName, String family);

    public abstract <T extends BaseLibEntity> SaveToUDBHandler<T> getUDBHandler(String tableName);
}
